<%--
$Id: user-list.jsp 13 2010-11-02 15:35:59Z feigme $
--%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/WEB-INF/content/commons/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><fmt:message key="user.manager"/></title>
</head>
<body>
<%@ include file="user-menu.jsp" %>
<div>
<table width="100%" class="solidtable">
	<tr>
		<td class="solidtr" width="30" align="center"><fmt:message key="common.id"/></td>
		<td class="solidtr"><fmt:message key="user.email"/></td>
		<td class="solidtr"><fmt:message key="user.name"/></td>
		<td class="solidtr"><fmt:message key="common.create.date"/></td>
		<td class="solidtr"><fmt:message key="common.status"/></td>
		<td class="solidtr" align="center"><fmt:message key="common.action"/></td>
	</tr>
	
	<c:forEach items="${usersPage.result}" var="user">
	<tr>
		<td align="center"><c:out value="${user.id}"/></td>
		<td><c:out value="${user.email}"/></td>
		<td><c:out value="${user.name}"/></td>
		<td><fmt:formatDate value="${user.createDate}" pattern="yyyy-MM-dd HH:mm:ss"/></td>
		<td><a name="<c:out value="${user.id}"/>" href="javascript:changeUserStatus(<c:out value="${user.id}"/>);"><c:out value="${user.status}"/></a></td>
		<td></td>
	</tr>
	</c:forEach>
</table>
<table>
<tr>
	<td>
	<c:if test="${usersPage.hasPre}"><a href="${ctx }/admin/user/list/<c:out value="${usersPage.prePage}"/>"><fmt:message key="common.prev"/></a></c:if>
		<c:if test="${usersPage.totalPages>1}">
 		<c:forEach begin="1" var="page" end="${usersPage.totalPages}">
 			&nbsp;
	 		<c:choose>
				<c:when test="${usersPage.pageNo!=page}">
					<a href="${ctx }/admin/user/list/<c:out value="${page}" />">
						<c:out value="${page}" />
					</a>	
				</c:when>
				<c:otherwise>
					<c:out value="${page}" />
				</c:otherwise>
			</c:choose>
 		</c:forEach>
 		</c:if>
 		<c:if test="${usersPage.hasNext}">&nbsp;<a href="${ctx }/admin/user/list/<c:out value="${usersPage.nextPage}" />"><fmt:message key="common.next"/></a></c:if>
	</td>
</tr>
</table>
</div>
<script type="text/javascript">
function changeUserStatus(id){
	jQuery.get("${ctx}/admin/user/"+id+"/status",function(data){
		$("a[name="+id+"]").text(data);
	});
}
</script>
</body>
</html>